<nz-card [nzBordered]="false">
  <form nz-form [nzLayout]="'inline'" (ngSubmit)="getData()" class="search__form">
    <nz-row [nzGutter]="{ md: 8, lg: 24, xl: 48 }">
      <nz-col nzMd="8" nzSm="24">
        <nz-form-item>
          <nz-form-label nzFor="no">规则编号</nz-form-label>
          <nz-form-control>
            <input nz-input [(ngModel)]="q.no" name="no" placeholder="请输入" id="no">
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col nzMd="8" nzSm="24">
        <nz-form-item>
          <nz-form-label nzFor="status">使用状态</nz-form-label>
          <nz-form-control>
            <nz-select [(ngModel)]="q.status" name="status" id="status" [nzPlaceHolder]="'请选择'" [nzShowSearch]="true">
              <nz-option *ngFor="let i of status; let idx = index" [nzLabel]="i.text" [nzValue]="idx"></nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
        <nz-form-item>
          <nz-form-label nzFor="callNo">调用次数</nz-form-label>
          <nz-form-control>
            <input nz-input id="callNo">
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
        <nz-form-item>
          <nz-form-label nzFor="updatedAt">更新日期</nz-form-label>
          <nz-form-control>
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
        <nz-form-item>
          <nz-form-label nzFor="status2">使用状态</nz-form-label>
          <nz-form-control>
            <nz-select [nzPlaceHolder]="'请选择'" nzId="status2" [nzShowSearch]="true">
              <nz-option *ngFor="let i of status; let idx = index" [nzLabel]="i.text" [nzValue]="idx"></nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
        <nz-form-item>
          <nz-form-label nzFor="status3">使用状态</nz-form-label>
          <nz-form-control>
            <nz-select [nzPlaceHolder]="'请选择'" nzId="status3" [nzShowSearch]="true">
              <nz-option *ngFor="let i of status; let idx = index" [nzLabel]="i.text" [nzValue]="idx"></nz-option>
            </nz-select>
          </nz-form-control>
        </nz-form-item>
      </nz-col>
      <nz-col [nzSpan]="expandForm ? 24 : 8" [class.text-right]="expandForm">
        <button nz-button type="submit" [nzType]="'primary'" [nzLoading]="loading">查询</button>
        <button nz-button type="reset" (click)="getData()" class="mx-sm">重置</button>
        <a (click)="expandForm=!expandForm">
          {{expandForm ? '收起' : '展开'}}
          <i class="anticon" [class.anticon-down]="!expandForm" [class.anticon-up]="expandForm"></i>
        </a>
      </nz-col>
    </nz-row>
  </form>

  <!-- <button nz-button (click)="add(modalContent)" [nzType]="'primary'">
    <i class="anticon anticon-plus"></i>
    <span>新建</span>
  </button>

  <button nz-button (click)="export(modalContent2)" [nzType]="'primary'">
    <i class="anticon anticon-plus"></i>
    <span>导入</span>
  </button> -->

  <ng-container *ngIf="selectedRows.length > 0">
    <button nz-button class="ml-sm">批量操作</button>
    <nz-dropdown [nzPlacement]="'bottomLeft'">
      <button nz-button nz-dropdown class="ml-sm">
        更多操作
        <i class="anticon anticon-down"></i>
      </button>
      <ul nz-menu>
        <li nz-menu-item (click)="remove()">删除</li>
        <!-- <li nz-menu-item (click)="approval()">批量审批</li> -->
      </ul>
    </nz-dropdown>
  </ng-container>
  <div class="my-md">
    <nz-alert [nzType]="'info'" [nzShowIcon]="true" [nzMessage]="message">
      <ng-template #message>
        已选择
        <strong class="text-primary">{{selectedRows.length}}</strong> 项&nbsp;&nbsp;
        <a *ngIf="totalCallNo > 0" (click)="st.clearCheck()" class="ml-lg">清空</a>
      </ng-template>
    </nz-alert>
  </div>
  <simple-table #st [columns]="columns" [data]="data" [loading]="loading" 
  (checkboxChange)="checkboxChange($event)" (filterChange)="getData()">
    <ng-template st-row="status" let-i>
      <nz-badge [nzStatus]="i.statusType" [nzText]="i.statusText"></nz-badge>
    </ng-template>
  </simple-table>
</nz-card>

<ng-template #modalContent>
  <form nz-form [formGroup]="form">
    <nz-form-item>
      <nz-form-label nzXs="5" nzRequired nzFor="name">姓名</nz-form-label>
      <nz-form-control nzXs="18">
        <input nz-input formControlName="name" id="name" placeholder="">
        <nz-form-explain *ngIf="form.get('name').dirty && form.get('name').errors">不能为空</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label nzXs="5" nzRequired nzFor="mobile">手机</nz-form-label>
      <nz-form-control nzXs="18">
        <input nz-input formControlName="mobile" id="mobile" placeholder="">
        <nz-form-explain *ngIf="form.get('mobile').dirty && form.get('mobile').errors">不能为空</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label nzXs="5" nzRequired nzFor="weixin">微信号</nz-form-label>
      <nz-form-control nzXs="18">
        <input nz-input formControlName="weixin" id="weixin" placeholder="">
        <nz-form-explain *ngIf="form.get('weixin').dirty && form.get('weixin').errors">不能为空</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label nzXs="5" nzRequired nzFor="from">来源</nz-form-label>
      <nz-form-control nzXs="18">
        <nz-select formControlName="from" [nzShowSearch]="true">
          <nz-option *ngFor="let i of fromList; let idx = index" [nzLabel]="i.name" [nzValue]="i.code"></nz-option>
        </nz-select>
        <nz-form-explain *ngIf="form.get('from').dirty && form.get('from').errors">不能为空</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label nzXs="5" nzRequired nzFor="status">状态</nz-form-label>
      <nz-form-control nzXs="18">
        <nz-select formControlName="status">
            <nz-option *ngFor="let i of statusList; let idx = index" [nzLabel]="i.name" [nzValue]="i.code"></nz-option>
        </nz-select>
        <nz-form-explain *ngIf="form.get('status').dirty && form.get('status').errors">不能为空</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label nzXs="5" nzFor="remarks">备注</nz-form-label>
      <nz-form-control nzXs="18">
        <textarea nz-input formControlName="remarks" id="remarks" [nzAutosize]="{minRows: 4}" placeholder=""></textarea>
        <nz-form-explain *ngIf="form.get('remarks').dirty && form.get('remarks').errors">不能为空</nz-form-explain>
      </nz-form-control>
    </nz-form-item>

  </form>

</ng-template>

<ng-template #modalContent2>
  <nz-upload nzAction="https://jsonplaceholder.typicode.com/posts/">
    <button nz-button>
      <i class="anticon anticon-upload"></i>
      <span>点击上传</span>
    </button>
  </nz-upload>

</ng-template>